#coding: utf-8

from django.db import models

CATEGORIES_CHOICES = (
    ('1','Receipts'),
    ('2','Minutes'),
    ('3','Calls'),
    ('4','Other'),
)

class UploadModel(models.Model):
    title = models.CharField(max_length=64, blank=True, verbose_name="Nome do Ficheiro")
    category = models.CharField(max_length=1, choices=CATEGORIES_CHOICES,  verbose_name="Categoria")
    file = models.FileField(upload_to='uploads/%Y/%m/%d/%H/%M/%S/', verbose_name="Ficheiro")

    @property
    def filename(self):
        return self.file.name.rsplit('/', 1)[-1]

    def __unicode__(self):
        return self.title
